package com.junjie.checkin.controller;

import com.junjie.checkin.request.pointRecord.PointRecordPageRequest;
import com.junjie.checkin.response.PageResult;
import com.junjie.checkin.response.Result;
import com.junjie.checkin.response.ResultStatus;
import com.junjie.checkin.response.pointRecord.PointRecordResponse;
import com.junjie.checkin.service.PointRecordService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 洪浚杰
 * @description 积分明细控制器
 * @date 2025/6/17 20:39
 */
@RestController
@RequestMapping("/pointRecord")
public class PointRecordController {
    @Autowired
    private PointRecordService pointRecordService;
    /**
     * 前台获取积分明细列表
     */
    @GetMapping("")
    public Result<PageResult<PointRecordResponse>> getPointRecord(PointRecordPageRequest pageRequest, HttpServletRequest request) {
        // 获取token
        String token = request.getHeader("Authorization");
        PageResult<PointRecordResponse> pointRecord = pointRecordService.getPointRecord(pageRequest, token);
        return Result.getResult(ResultStatus.OK, pointRecord);
    }
}
